﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics.Contracts;
using System.Linq;

using NHibernate.Criterion;

using ProjectBase.Core;

namespace $safeprojectname$.NH
{
    public class LikeCollationExpression : LikeExpression
    {
        const string CollationDefinition = " COLLATE {0} ";

        #region constructor
        public LikeCollationExpression(string propertyName, string value, char? escapeChar, bool ignoreCase)
            : base(propertyName, value, escapeChar, ignoreCase)
        {
        }

        public LikeCollationExpression(IProjection projection, string value, MatchMode matchMode)
            : base(projection, value, matchMode)
        {
        }
        public LikeCollationExpression(string propertyName, string value)
            : base(propertyName, value)
        {
        }
        public LikeCollationExpression(string propertyName, string value, MatchMode matchMode)
            : base(propertyName, value, matchMode)
        {
        }
        public LikeCollationExpression(string propertyName, string value, MatchMode matchMode, char? escapeChar, bool ignoreCase)
            : base(propertyName, value, matchMode, escapeChar, ignoreCase)
        {
        }
        #endregion constructor

        public override global::NHibernate.SqlCommand.SqlString ToSqlString(global::NHibernate.ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, global::NHibernate.IFilter> enabledFilters)
        {
            var result = base.ToSqlString(criteria, criteriaQuery, enabledFilters);
            var sqlStringBuilder = new global::NHibernate.SqlCommand.SqlStringBuilder(result);
            sqlStringBuilder.Add(CollationDefinition.FormatWith(Global.Settings.DaoDefaultLikeCollation));

            return sqlStringBuilder.ToSqlString();
        }
    }
}
